package com.zzzfwd.menuhelper

import android.content.SharedPreferences
import androidx.core.content.edit

class MenuRepository(private val sharedPreferences: SharedPreferences) {

    companion object {
        private const val CONFIGURATION_SHARED_PREF = "configuration_shared_pref"
        private const val TOTAL_PRICE = "totalPrice"
        private const val CONFIGURATIONS = "configurations"
    }

    fun getTotalPrice() = sharedPreferences.getInt(TOTAL_PRICE, 0)

    fun saveTotalPrice(totalPrice: Int) = sharedPreferences.edit {
        putInt(TOTAL_PRICE, totalPrice)
    }

    fun getConfigurations() = sharedPreferences.getString(CONFIGURATIONS, null)

    fun saveConfigurations(configurations: String) = sharedPreferences.edit {
        putString(CONFIGURATIONS, configurations)
    }
}